#ifndef __CREATEINVERTINDEXTABLE_HPP__
#define __CREATEINVERTINDEXTABLE_HPP__

#include <regex>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <sstream>

using namespace std;

class InvertIndex {
public:
    InvertIndex();
    void getPageContent();                     // 获取每个网页的content内容
    void calculateIDF();                       // 计算IDF值
    void calculateWeight();                    // 计算每个词的权重
    void generateInvertIndexTable();           // 生成倒排索引库

private:
    map<int, string> _pageContent;                                      // 以docid为key值的去重后的每篇网页的内容(无url和title)
    map<int, map<string, double>> _frequencyWithId;                     // 每个网页的词频, TF
    map<string, double> _wordIDF;                                       // 每个词的IDF值
    map<int, map<string, double>> _normalizedWeight;                    // 归一化后的权重w'
    unordered_map<string, vector<pair<int, double>>> _invertIndexTable; // 倒排索引表
};

#endif